package com.mxy.myapplication.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.annotation.Nullable;

import com.mxy.myapplication.aidl.IMyAidlInterface;

public class MyServiceOnDifferentProcess extends Service {


  private IMyAidlInterface.Stub iMyAidlInterface = new IMyAidlInterface.Stub() {

    @Override
    public String getName() {
      return getString();
    }

    @Override
    public int getAge() {
      return getInt();
    }
  };

  @Override
  public void onCreate() {
    super.onCreate();
    System.out.println("MyServiceOnDifferentProcess onCreate");
  }

  @Nullable
  @Override
  public IBinder onBind(Intent intent) {
    System.out.println("MyServiceOnDifferentProcess   onBind");
    return iMyAidlInterface;
  }

  @Override
  public boolean onUnbind(Intent intent) {
    System.out.println("MyServiceOnDifferentProcess   onUnbind");
    return super.onUnbind(intent);
  }

  @Override
  public void onDestroy() {
    System.out.println("MyServiceOnDifferentProcess onDestroy");
    super.onDestroy();
  }

  private String getString() {
    return "马晓勇";
  }

  private int getInt() {
    return 32;
  }
}
